package com.zzxx.service.impl;

import com.github.pagehelper.PageHelper;
import com.zzxx.domain.Permission;
import com.zzxx.mapper.PermissionMapper;
import com.zzxx.service.PermissionService;
import com.zzxx.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;
    @Override
    public List<Permission> queryAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return permissionMapper.findAll();
    }

    @Override
    public void add(Permission permission) {
        permission.setId(UUIDUtils.uuid());
        permissionMapper.add(permission);
    }
}
